home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-01-19 | 1.0 KB | 45 lines | [TEXT/MPS ] |
- /*
- * File Driver.c
- */
-
- #include <types.h>
- #include <StdIO.h>
-
- /*
- Declare the stuff in Test.p
- */
- pascal void initialize (short) extern;
- pascal short getval () extern;
- /*
- The following structure acts as a reference to the data in the pascal module
- <test.p> but it cannot be referenced directly because C assumes that the
- address of a structure points at its beginning and pascal points to the end
- of its data block.
- */
- extern struct testData {
- short a;
- short b;
- short c;
- } TEST;
-
- struct testData *tData;
-
- int main()
- {
- /*
- Adjust tData to point to the beginning of the Test global data block.
- */
- tData = (&TEST) - 1; /* -1 subtracts sizeof(TEST) */
-
- tData->a = 2;
- tData->b = 20;
- tData->c = 200;
-
- printf ("Values set directly: %d, %d, %d.\n", tData->a, tData->b, tData->c);
- initialize (98);
- printf ("Value set indirectly to 98 is %d.\n", getval());
- return 0;
- }
- eadString (VAR string:Str255; VAR length:INTEGER);
- (*
- Read the pascal formatted string from